Skip to content

Restore execution count after sticky-spinner. - #344239

Open
Samuel Ferencik (sferencik) wants to merge 2 commits into
microsoft:mainfrom
sferencik:fix-sticky-execution-spinner
Open

Samuel Ferencik (sferencik) wants to merge 2 commits into
microsoft:mainfrom
sferencik:fix-sticky-execution-spinner

Conversation

@sferencik

Copy link
Copy Markdown

When executing a tall notebook code cell that produces no output while its bottom edge is scrolled below the viewport, the sticky execution spinner in the left gutter remains stuck spinning after execution finishes instead of transitioning to the [n] execution count (#250130).

This fixes ad80711 (#250327), which renamed the spinner class on _executionOrderLabel from sticky to sticky-spinner:

  1. The cleanup branches in _updatePosition() still checked and removed sticky rather than the new sticky-spinner, undoing Fix notebook sticky execution spinner getting stuck after execution finishes #250131 and leaving the spinner stuck in the gutter once execution finished. Cells that produce output happened to self-heal only because _updatePerformanceMetadata() updates renderDuration asynchronously after completion, firing a second internalMetadataChanged event once cellIsRunning is already false.
  2. isAlreadyIcon checked sticky-spinner on _executionOrderContent instead of _executionOrderLabel, always returning false and recreating the spinner DOM on every scroll event.

How to test

  1. Save the following as repro.ipynb and open it in VS Code:
    {
      "cells": [
        {
          "cell_type": "code",
          "execution_count": null,
          "metadata": {},
          "outputs": [],
          "source": [
            "import time\ntime.sleep(2)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# bottom of cell"
          ]
        }
      ],
      "metadata": {
        "language_info": {
          "name": "python"
        }
      },
      "nbformat": 4,
      "nbformat_minor": 5
    }
  2. With the top of the cell in view and # bottom of cell scrolled below the bottom of the viewport, run the cell using the cell's Execute button (Ctrl+Enter / Cmd+Enter) and wait 2 seconds without scrolling.
  3. Scroll down to # bottom of cell and verify that the gutter shows [1] next to ✓ 2.0s rather than a stuck spinning icon.

sferencik added 2 commits October 26, 2026 03:09
This follows ad80711 (microsoft#250327), which renamed the spinner class on
`_executionOrderLabel` from `sticky` to `sticky-spinner`. The cleanup
branches in `_updatePosition()` still checked and removed `sticky`,
reintroducing microsoft#250130 (microsoft#250131) after cell execution finished.
This follows ad80711 (microsoft#250327) and relates to microsoft#250130. Checking
`sticky-spinner` on `_executionOrderContent` instead of
`_executionOrderLabel` always returned `false`, recreating the spinner
DOM on every scroll event. Clear it when overwriting `innerText`.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The localized changes consistently correct spinner-state handling, with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes notebook execution-count restoration after the sticky-spinner class rename, addressing the stuck spinner reported in #250130.

Changes:

  • Uses sticky-spinner consistently when checking and clearing sticky state.
  • Checks the label element to avoid recreating the spinner on every scroll.
  • Clears spinner state when execution-count content is refreshed or removed.
File Description
src/​vs/​workbench/​contrib/​notebook/​browser/​view/​cellParts/​cellExecution.ts Corrects spinner-state tracking and restores execution-count labels.

Review effort: Balanced

@sferencik

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants